﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'PRC_TB_ALERTS_TASKS_IN')
	BEGIN
		DROP  Procedure  dbo.PRC_TB_ALERTS_TASKS_IN
	END

GO

CREATE Procedure dbo.PRC_TB_ALERTS_TASKS_IN
	(
		@TAT_ALERT_ID int,
		@TAT_SCHEDULE_START_FROM datetime,
		@TAT_SCHEDULE_START_TO datetime,
		@TAT_SCHEDULE_END_FROM datetime,
		@TAT_SCHEDULE_END_TO datetime
	)

AS

insert into TB_ALERTS_TASKS
(TAT_ALERT_ID,
 TAT_SCHEDULE_START_FROM,
 TAT_SCHEDULE_START_TO,
 TAT_SCHEDULE_END_FROM,
 TAT_SCHEDULE_END_TO)
values
(@TAT_ALERT_ID,
 @TAT_SCHEDULE_START_FROM,
 @TAT_SCHEDULE_START_TO,
 @TAT_SCHEDULE_END_FROM,
 @TAT_SCHEDULE_END_TO)

select @@identity

GO

GRANT EXEC ON dbo.PRC_TB_ALERTS_TASKS_IN TO PUBLIC

GO